package com.xiaoqiang.commons.base.dto;

import com.xiaoqiang.commons.base.status.BaseRestRequestStatusEnums;
import com.xiaoqiang.commons.base.status.Status;
import lombok.Getter;

@Getter
public class BaseResponse<T> implements Response {
    private int code;
    private String message;
    private T data;

    public BaseResponse() {
        this(null);
    }

    public BaseResponse(T data) {
        this(BaseRestRequestStatusEnums.SUCCESS, data);
    }

    public BaseResponse(Status status, T data) {
        this(status.getCode(), status.getDescription(), data);
    }

    public BaseResponse(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
